package tech.aistar.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import tech.aistar.entity.Cart;
import tech.aistar.entity.User;

import java.util.List;

/**
 * mapper接口
 */
public interface UserMapper {

    /**
     * 查询数据表中所有的用户的信息
     * @return
     */
    @Select("select * from t_user")
    List<User> findAll();

    @Select("select * from t_user where username=#{username}")
    User findByUsername(String username);

    @Insert("insert into t_user(username,password,power,phone,question,answer) values(#{username},#{password},1,#{phone},#{question},#{answer})")
    void save(User user);
}
